/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


#ifndef __SG_CLIENT_H__
#define __SG_CLIENT_H__


typedef struct {
	int						sequence;

	playerState_t			state;

	int						numEntities;
	entityState_t *			entities;
} clientSnapshot_t;

// Client data that stays across multiple respawns, but is cleared on each
// level change or team change at SG_ClientBegin
typedef struct {
	bool					connected;
	int						clientNum;

	char					name[MAX_NAME_LENGTH];
	bool					localClient;		// True if "ip" is "localhost"
} clientPersistent_t;

typedef struct client_s {
	playerState_t			state;

	clientPersistent_t		persistent;

	bool					spectator;

	int						ping;

	clientSnapshot_t *		snapshots[PACKET_BACKUP];

	odPhysicsPlayer			physics;
} client_t;

const char *	SG_ClientConnect (int clientNum, bool firstTime, const char *ip, char *userInfo);
void			SG_ClientDisconnect (int clientNum);
void			SG_ClientUserInfoChanged (int clientNum, char *userInfo);
void			SG_ClientBegin (int clientNum);
void			SG_ClientCommand (int clientNum);
void			SG_ClientThink (int clientNum, const userCmd_t *userCmd);
void			SG_ClientWriteGameState (int clientNum, ByteBuffer *msg);
void			SG_ClientWriteSnapshot (int clientNum, ByteBuffer *msg);


#endif	// __SG_CLIENT_H__
